In Svelte, you can capture input events using the on: directive. This allows you to listen for events like keydown, input, change, focus, and others directly on form elements or components.
Use on:eventname={handler} to attach event listeners.
The input event fires immediately when the value changes, suitable for live updates.
change fires when an input loses focus or a selection changes.
keydown, keyup, and keypress capture keyboard interactions.
Event objects contain useful properties like event.target.value and event.key.